<template>
  <div class="base-info-view">
    <el-form
      class="form-detail"
      label-position="right"
      label-width="120px"
    >
      <el-row
        :gutter="20"
        style="width:100%"
      >
        <el-col :span="8">
          <el-form-item
            label="流程编号："
            style="width: 100%;"
          >
            <span>{{ detailData.processNo }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item
            label="创建时间："
            style="width: 100%;"
          >
            {{ dateFormat('yyyy-mm-dd HH:MM', detailData.startTime) }}
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item
            label="创建人："
            style="width: 100%;"
          >
            <span>{{ detailData.initiator }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item
            label="产品编号："
            style="width: 100%"
          >
            <div>{{ data?.productNumber }}</div>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item
            label="产品名称："
            style="width: 100%"
          >
            <div>{{ getProductName(data) }}</div>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item
            label="市场价："
            style="width: 100%"
          >
            <div>
              <span>{{ data?.marketPrice }}元</span>
              <span v-if="data?.sellUnit">/{{ getLabel('sell_unit',data?.sellUnit) }}</span>
            </div>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <item-title title="价格信息" />
    <el-form
      class="form-detail"
      label-position="right"
      label-width="120px"
      style="padding-left:20px;"
    >
      <el-row
        :gutter="20"
        style="width:100%"
      >
        <el-form-item
          label="价格编号："
          style="width: 50%"
        >
          <div>{{ data?.priceNumber }}</div>
        </el-form-item>
        <el-form-item
          label="准入模式："
          style="width: 50%"
        >
          <div>{{ getLabel('access_mode', data?.accessMode) }}</div>
        </el-form-item>
        <el-form-item
          label="价格属性："
          style="width: 50%"
        >
          <div>{{ getLabel('price_type', data?.priceType) }}</div>
        </el-form-item>
        <el-form-item
          label="适用地区："
          style="width: 50%"
        >
          <area-list-view :areas="data?.region" />
        </el-form-item>
        <el-form-item
          label="适用终端："
          style="width: 50%"
        >
          <div>{{ getLabel('app_mode', data?.terminalType) }}</div>
        </el-form-item>
        <el-form-item
          label="终端价："
          style="width: 50%"
        >
          <div>
            <span>{{ data?.terminalPrice }}元</span>
            <span v-if="data?.sellUnit">/{{ getLabel('sell_unit',data?.sellUnit) }}</span>
          </div>
        </el-form-item>
        <el-form-item
          label="指导交易价："
          style="width: 50%"
        >
          <div>
            <span>{{ data?.guidingPrice }}元</span>
            <span v-if="data?.sellUnit">/{{ getLabel('sell_unit',data?.sellUnit) }}</span>
          </div>
        </el-form-item>
        <!--
        <el-form-item
          label="价格来源："
          style="width: 50%"
        >
          <div>{{ getLabel('price_source', data?.priceSource) }}</div>
        </el-form-item>
        <el-form-item
          label="价格来源描述："
          style="width: 50%"
        >
          <div>{{ data?.priceSourceDesc }}</div>
        </el-form-item>
        -->
      </el-row>
      <el-row
        :gutter="20"
        style="width:100%"
      >
        <el-form-item label="作废原因：">
          <div>{{ data?.banReason||'无' }}</div>
        </el-form-item>
      </el-row>

    </el-form>

  </div>
</template>

<script>
import { reactive, toRefs, watch } from 'vue'

export default {
  name: 'ClientPriceBaseInfo',
  props: {
    detailData: {
      type: Object,
      default: () => {},
    },
  },
  setup(props, context) {
    var reactiveData = reactive({
      detailData: {},
      data: props.detailData.data,
    })
    watch(
      () => props.detailData,
      (newval, oldval) => {
        if (newval) {
          reactiveData.detailData = newval
          reactiveData.data = newval.data
          console.log(232)
        }
      },
      { immediate: true, deep: true }
    )
    return {
      ...toRefs(props),
      ...toRefs(reactiveData),
    }
  },
}
</script>

<style scoped>
</style>
